<?php

namespace App\Http\Controllers\admin;
use App\Http\Requests\AdminPost;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Auth;
class EntryController extends Controller
{
    /*
     * 构造方法进行登录的验证
     *
     */

    public function __construct()
	{
		$this->middleware('admin.auth');
	}

	/*
	 * 后台的欢迎界面
	 */
	public function index(){

		return view('admin.entry.index');
	}
	/*
	 * 修改密码的函数
	 */

	public function pass(){
		return view('admin.entry.pass');
	}
	/*
	 * 修改密码
	 */
	public function changePass(AdminPost $request){
		$model=Auth::guard('admin')->user();
//		dd($model);die;
		$model->password=bcrypt($request->input('password'));
		$model->save();
		return redirect()->back();
	}
	/*
	 * 退出登录
	 */
	public function logout(){
		Auth::logout();
		return redirect('/admin/login');
	}



}
